/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Beans;

import java.util.ArrayList;
import javax.faces.model.SelectItem;

/**
 *
 * @author Kim
 */
public class ComboBoxBean {
    private ArrayList<SelectItem> arr;
    
    public ArrayList<SelectItem> getItem(){
        arr=new ArrayList<SelectItem>();
        arr.add(new SelectItem("1","HCM"));
        arr.add(new SelectItem("2","HN"));
        arr.add(new SelectItem("3","DN"));                
        return arr;
    }
    public String getcityName(int id){
        //search with this id on city table
        String name="";
        arr=new ArrayList<SelectItem>();
        arr.add(new SelectItem("1","HCM"));
        arr.add(new SelectItem("2","HN"));
        arr.add(new SelectItem("3","DN"));      
        for(int i=0;i<arr.size();i++){
            if(Integer.parseInt((String)arr.get(i).getValue())==id){
                name=arr.get(i).getLabel();
                break;
            }
        }
        return name;
    }
}
